{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "Dm-Ib6-Su1Ak"
      },
      "outputs": [],
      "source": [
        "from transformers import AutoProcessor, AutoModel\n",
        "processor = AutoProcessor.from_pretrained(\"suno/bark\")\n",
        "model = AutoModel.from_pretrained(\"suno/bark\")"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "inputs = processor(\n",
        "    text=[\n",
        "        \"Hi! My name is Meysam. I like TRANSFORMERS [laughs] I mean, I really like it [clears throat] I have been working in field on NLP (Natural Language Processing) for almost adecade\"\n",
        "    ],\n",
        "    return_tensors=\"pt\",\n",
        ")\n",
        "speech = model.generate(**inputs, do_sample=True)\n"
      ],
      "metadata": {
        "id": "w8qgHNx8u6Rd"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "from IPython.display import Audio\n",
        "\n",
        "Audio(speech.cpu().numpy().squeeze(), rate=model.generation_config.sample_rate)\n"
      ],
      "metadata": {
        "id": "-I8X3PX2vAkm"
      },
      "execution_count": null,
      "outputs": []
    }
  ]
}